Optimal. Leaf size=119 \[ \frac {a^2 (a B+3 A b) \log (\sin (c+d x))}{d}-x \left (a^3 A-3 a^2 b B-3 a A b^2+b^3 B\right )+\frac {b^2 (a A+b B) \tan (c+d x)}{d}-\frac {b^2 (3 a B+A b) \log (\cos (c+d x))}{d}-\frac {a A \cot (c+d x) (a+b \tan (c+d x))^2}{d} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.26, antiderivative size = 119, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 4, integrand size = 31, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.129, Rules used = {3605, 3637, 3624, 3475} \[ -x \left (a^3 A-3 a^2 b B-3 a A b^2+b^3 B\right )+\frac {a^2 (a B+3 A b) \log (\sin (c+d x))}{d}+\frac {b^2 (a A+b B) \tan (c+d x)}{d}-\frac {b^2 (3 a B+A b) \log (\cos (c+d x))}{d}-\frac {a A \cot (c+d x) (a+b \tan (c+d x))^2}{d} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 3475
Rule 3605
Rule 3624
Rule 3637
Rubi steps
\begin {align*} \int \cot ^2(c+d x) (a+b \tan (c+d x))^3 (A+B \tan (c+d x)) \, dx &=-\frac {a A \cot (c+d x) (a+b \tan (c+d x))^2}{d}+\int \cot (c+d x) (a+b \tan (c+d x)) \left (a (3 A b+a B)-\left (a^2 A-A b^2-2 a b B\right ) \tan (c+d x)+b (a A+b B) \tan ^2(c+d x)\right ) \, dx\\ &=\frac {b^2 (a A+b B) \tan (c+d x)}{d}-\frac {a A \cot (c+d x) (a+b \tan (c+d x))^2}{d}-\int \cot (c+d x) \left (-a^2 (3 A b+a B)+\left (a^3 A-3 a A b^2-3 a^2 b B+b^3 B\right ) \tan (c+d x)-b^2 (A b+3 a B) \tan ^2(c+d x)\right ) \, dx\\ &=-\left (a^3 A-3 a A b^2-3 a^2 b B+b^3 B\right ) x+\frac {b^2 (a A+b B) \tan (c+d x)}{d}-\frac {a A \cot (c+d x) (a+b \tan (c+d x))^2}{d}+\left (a^2 (3 A b+a B)\right ) \int \cot (c+d x) \, dx+\left (b^2 (A b+3 a B)\right ) \int \tan (c+d x) \, dx\\ &=-\left (a^3 A-3 a A b^2-3 a^2 b B+b^3 B\right ) x-\frac {b^2 (A b+3 a B) \log (\cos (c+d x))}{d}+\frac {a^2 (3 A b+a B) \log (\sin (c+d x))}{d}+\frac {b^2 (a A+b B) \tan (c+d x)}{d}-\frac {a A \cot (c+d x) (a+b \tan (c+d x))^2}{d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] time = 0.52, size = 113, normalized size = 0.95 \[ \frac {-2 a^3 A \cot (c+d x)+2 a^2 (a B+3 A b) \log (\tan (c+d x))+i (a+i b)^3 (A+i B) \log (-\tan (c+d x)+i)+(b+i a)^3 (A-i B) \log (\tan (c+d x)+i)+2 b^3 B \tan (c+d x)}{2 d} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 0.67, size = 145, normalized size = 1.22 \[ \frac {2 \, B b^{3} \tan \left (d x + c\right )^{2} - 2 \, A a^{3} - 2 \, {\left (A a^{3} - 3 \, B a^{2} b - 3 \, A a b^{2} + B b^{3}\right )} d x \tan \left (d x + c\right ) + {\left (B a^{3} + 3 \, A a^{2} b\right )} \log \left (\frac {\tan \left (d x + c\right )^{2}}{\tan \left (d x + c\right )^{2} + 1}\right ) \tan \left (d x + c\right ) - {\left (3 \, B a b^{2} + A b^{3}\right )} \log \left (\frac {1}{\tan \left (d x + c\right )^{2} + 1}\right ) \tan \left (d x + c\right )}{2 \, d \tan \left (d x + c\right )} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [A] time = 2.39, size = 152, normalized size = 1.28 \[ \frac {2 \, B b^{3} \tan \left (d x + c\right ) - 2 \, {\left (A a^{3} - 3 \, B a^{2} b - 3 \, A a b^{2} + B b^{3}\right )} {\left (d x + c\right )} - {\left (B a^{3} + 3 \, A a^{2} b - 3 \, B a b^{2} - A b^{3}\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) + 2 \, {\left (B a^{3} + 3 \, A a^{2} b\right )} \log \left ({\left | \tan \left (d x + c\right ) \right |}\right ) - \frac {2 \, {\left (B a^{3} \tan \left (d x + c\right ) + 3 \, A a^{2} b \tan \left (d x + c\right ) + A a^{3}\right )}}{\tan \left (d x + c\right )}}{2 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [A] time = 0.36, size = 168, normalized size = 1.41 \[ -A \,a^{3} x +3 A x a \,b^{2}+3 B x \,a^{2} b -B x \,b^{3}-\frac {A \cot \left (d x +c \right ) a^{3}}{d}-\frac {A \,b^{3} \ln \left (\cos \left (d x +c \right )\right )}{d}+\frac {3 A \,a^{2} b \ln \left (\sin \left (d x +c \right )\right )}{d}-\frac {A \,a^{3} c}{d}+\frac {3 A a \,b^{2} c}{d}+\frac {B \tan \left (d x +c \right ) b^{3}}{d}-\frac {3 B a \,b^{2} \ln \left (\cos \left (d x +c \right )\right )}{d}+\frac {a^{3} B \ln \left (\sin \left (d x +c \right )\right )}{d}+\frac {3 B \,a^{2} b c}{d}-\frac {B \,b^{3} c}{d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [A] time = 0.77, size = 125, normalized size = 1.05 \[ \frac {2 \, B b^{3} \tan \left (d x + c\right ) - \frac {2 \, A a^{3}}{\tan \left (d x + c\right )} - 2 \, {\left (A a^{3} - 3 \, B a^{2} b - 3 \, A a b^{2} + B b^{3}\right )} {\left (d x + c\right )} - {\left (B a^{3} + 3 \, A a^{2} b - 3 \, B a b^{2} - A b^{3}\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) + 2 \, {\left (B a^{3} + 3 \, A a^{2} b\right )} \log \left (\tan \left (d x + c\right )\right )}{2 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 6.41, size = 114, normalized size = 0.96 \[ \frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )\right )\,\left (B\,a^3+3\,A\,b\,a^2\right )}{d}-\frac {A\,a^3\,\mathrm {cot}\left (c+d\,x\right )}{d}+\frac {B\,b^3\,\mathrm {tan}\left (c+d\,x\right )}{d}+\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )-\mathrm {i}\right )\,\left (A+B\,1{}\mathrm {i}\right )\,{\left (a+b\,1{}\mathrm {i}\right )}^3\,1{}\mathrm {i}}{2\,d}-\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,\left (A-B\,1{}\mathrm {i}\right )\,{\left (a-b\,1{}\mathrm {i}\right )}^3\,1{}\mathrm {i}}{2\,d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [A] time = 1.94, size = 223, normalized size = 1.87 \[ \begin {cases} \tilde {\infty } A a^{3} x & \text {for}\: c = 0 \wedge d = 0 \\x \left (A + B \tan {\relax (c )}\right ) \left (a + b \tan {\relax (c )}\right )^{3} \cot ^{2}{\relax (c )} & \text {for}\: d = 0 \\\tilde {\infty } A a^{3} x & \text {for}\: c = - d x \\- A a^{3} x - \frac {A a^{3}}{d \tan {\left (c + d x \right )}} - \frac {3 A a^{2} b \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} + \frac {3 A a^{2} b \log {\left (\tan {\left (c + d x \right )} \right )}}{d} + 3 A a b^{2} x + \frac {A b^{3} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} - \frac {B a^{3} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} + \frac {B a^{3} \log {\left (\tan {\left (c + d x \right )} \right )}}{d} + 3 B a^{2} b x + \frac {3 B a b^{2} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} - B b^{3} x + \frac {B b^{3} \tan {\left (c + d x \right )}}{d} & \text {otherwise} \end {cases} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________